#include <vector>
using namespace std;
class Solution
{
public:
    bool canPlaceFlowers(vector<int> &flowerbed, int n)
    {
        flowerbed.insert(flowerbed.begin(), 0);
        flowerbed.insert(flowerbed.end(), 0);
        int size = flowerbed.size();
        int i = 1;

        while (i < size - 1)
        {
            if (!flowerbed[i] && !flowerbed[i - 1] && !flowerbed[i + 1])
            {
                flowerbed[i] = 1;
                n--;
                i += 2;
            }
            else
            {
                i++;
            }
            if (n <= 0)
            {
                break;
            }
        }
        return n <= 0;
    }
};
int main(int argc, char const *argv[])
{
    Solution s;

    return 0;
}
